/*
 * FontSet.java  0.4.0 / Oct 25, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.styles;

import com.cute4j.swing.graphics.Font;
import com.cute4j.util.Utilities;

/**
 * Font Set.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public abstract class FontSet {

// Public Methods. -------------------------------------------------------------

  /**
   * Returns the name of the font set.
   *
   * @return the name of the font set
   */
  public abstract String getName();

  /**
   * Returns default font.
   *
   * @return default font
   */
  public abstract Font getDefaultFont();

  /**
   * Returns fixed font.
   *
   * @return fixed font
   */
  public abstract Font getFixedFont();

  /**
   * Returns component font.
   *
   * @return component font
   */
  public abstract Font getComponentFont();

  /**
   * Returns button font.
   *
   * @return button font
   */
  public abstract Font getButtonFont();

  /**
   * Returns menu font.
   *
   * @return menu font
   */
  public abstract Font getMenuFont();

  /**
   * Returns menu bar font.
   *
   * @return menu bar font
   */
  public abstract Font getMenuBarFont();

  /**
   * Returns text font.
   *
   * @return text font
   */
  public abstract Font getTextFont();

  /**
   * Returns tool tip font.
   *
   * @return tool tip font
   */
  public abstract Font getToolTipFont();

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if ((obj != null) && (obj.getClass() == getClass())) {
      FontSet fs = (FontSet)obj;
      return (Utilities.equals(getName(), fs.getName()) &&
              Utilities.equals(getDefaultFont(), fs.getDefaultFont()) &&
              Utilities.equals(getFixedFont(), fs.getFixedFont()) &&
              Utilities.equals(getComponentFont(), fs.getComponentFont()) &&
              Utilities.equals(getButtonFont(), fs.getButtonFont()) &&
              Utilities.equals(getMenuFont(), fs.getMenuFont()) &&
              Utilities.equals(getMenuBarFont(), fs.getMenuBarFont()) &&
              Utilities.equals(getTextFont(), fs.getTextFont()) &&
              Utilities.equals(getToolTipFont(), fs.getToolTipFont()));
    }
    return false;
  }

  /**
   * {@inheritDoc}
   */
  public int hashCode() { // NOPMD
    int hashCode = 439;
    String name = getName();
    if (name != null) {
      hashCode = 107 * hashCode + name.hashCode();
    }
    Font f = getDefaultFont();
    if (f != null) {
      hashCode = 107 * hashCode + f.hashCode();
    }
    f = getFixedFont();
    if (f != null) {
      hashCode = 107 * hashCode + f.hashCode();
    }
    f = getComponentFont();
    if (f != null) {
      hashCode = 107 * hashCode + f.hashCode();
    }
    f = getButtonFont();
    if (f != null) {
      hashCode = 107 * hashCode + f.hashCode();
    }
    f = getMenuFont();
    if (f != null) {
      hashCode = 107 * hashCode + f.hashCode();
    }
    f = getTextFont();
    if (f != null) {
      hashCode += f.hashCode();
    }
    f = getMenuBarFont();
    if (f != null) {
      hashCode = 107 * hashCode + f.hashCode();
    }
    f = getToolTipFont();
    if (f != null) {
      hashCode = 107 * hashCode + f.hashCode();
    }
    return hashCode;
  }

  /**
   * {@inheritDoc}
   */
  public String toString() {
    return getName();
  }

}
